﻿using Microsoft.CSharp.Activities;
using System;
using System.Activities;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WFExtended.Twitter.Activities.Designers;

namespace WFExtended.Twitter.Activities
{
    /// <summary>
    /// Returns a collection of numeric IDs for every protected user for whom the authenticating user has a pending follow request.
    /// </summary>
    [ToolboxBitmapAttribute(typeof(EntryPoint), "Resources.RelationshipToolbox.bmp")]
    [Designer(typeof(RelationshipDesigner))]
    [Description("Returns a collection of numeric IDs for every protected user for whom the authenticating user has a pending follow request.")]
    public class GetFriendshipsOutgoing : TwitterOperationInvoker<IdsList>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="GetFriendshipsOutgoing"/> class.
        /// </summary>
        public GetFriendshipsOutgoing()
            : base("GetFriendshipsOutgoing")
        {
            Cursor = new InArgument<long>(new CSharpValue<long>("-1"));
        }

        /// <summary>
        /// Causes the results to be broken into pages of no more than 20 records at a time.
        /// <remarks>
        /// Required Argument
        /// </remarks>
        /// </summary>
        /// <value>
        /// The cursor.
        /// </value>
        [Browsable(true)]
        [Category("Properties")]
        [Description("Causes the results to be broken into pages of no more than 20 records at a time.")]
        [RequiredArgument]
        public InArgument<long> Cursor { get; set; }


        /// <summary>
        /// Caches the metadata.
        /// </summary>
        /// <param name="metadata">The metadata.</param>
        protected override void CacheMetadata(System.Activities.NativeActivityMetadata metadata)
        {
            RuntimeArgument cursorArgument = new RuntimeArgument("Cursor", typeof(long), ArgumentDirection.In, true);
            metadata.Bind(Cursor, cursorArgument);
            metadata.AddArgument(cursorArgument);

            base.CacheMetadata(metadata);
        }

        /// <summary>
        /// Executes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void Execute(System.Activities.NativeActivityContext context)
        {
            Parameters.Clear();

            Parameters.Add("cursor", Cursor);

            base.Execute(context);
        }
    }
}
